
//
//  CXSecondTableViewCell.m
//  ProjectOfBStage
//
//  Created by cuixin on 15/11/14.
//  Copyright © 2015年 cuixin. All rights reserved.
//

#import "CXSecondTableViewCell.h"
#import "CXSecondCollectionViewCell.h"

@implementation CXSecondTableViewCell
-(void)dealloc{
    [_collectionView release];
    [_array release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.array = [NSMutableArray array];
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        
        self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout];
        flowLayout.minimumInteritemSpacing = 0;
        flowLayout.minimumLineSpacing = 0;
        flowLayout.itemSize = CGSizeMake(WIDTH_PRO(80), HEIGHT_PRO(130));
        flowLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
        
        flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        self.collectionView.bounces = NO;
        self.collectionView.showsHorizontalScrollIndicator = NO;
        
        self.collectionView.backgroundColor = [UIColor whiteColor];
        [self.collectionView reloadData];

        [self.collectionView registerClass:[CXSecondCollectionViewCell class] forCellWithReuseIdentifier:@"CXSecondCollectionViewCellID"];
        [self.contentView addSubview:self.collectionView];
    }
    return self;
    
}

-(void)layoutSubviews{
    [super layoutSubviews];
}
-(void)setDataSource:(id<UICollectionViewDataSource>)dataSource{
    [self.collectionView setDataSource:dataSource];
}
-(void)setDelegate:(id<UICollectionViewDelegate>)delegate{
    [self.collectionView setDelegate:delegate];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
